import React from 'react';
// import {useParams} from "react-router-dom";
// import {useSearchParams} from "react-router-dom";
import {useLocation} from "react-router-dom";

export default function Detail() {
    // params
    // const {id, title, content} = useParams()
    // Search
    // const [search, setSearch] = useSearchParams()
    // const id = search.get('id')
    // const title = search.get('title')
    // const content = search.get('content')
    // state
    // const {id, title, content} = useLocation().state
    // 编程式路由导航
    const {id, title, content} = useLocation().state
    return (
        <ul>
            {/*<li>*/}
            {/*    <button onClick={()=>{setSearch('id=009&title=哈哈&content=嘎嘎')}}>点我更新search参数</button>*/}
            {/*</li>*/}
            <li>{id}</li>
            <li>{title}</li>
            <li>{content}</li>
        </ul>
    )
}